using System.Collections.Generic;
using System.Data.Linq;
using Magiq.Databases;
using Magiq.Support;

namespace Magiq.Providers.Sql.Insert
{
    public class InsertTable<TNew> : DatabaseOperation, IInsertDestination<TNew>
    {
        private readonly ITable table;

        public InsertTable(ITable table, LinqToSqlAdapter linqToSqlAdapter)
        {
            OrmAdapter = linqToSqlAdapter;
            this.table = table;
        }

        #region IInsertDestination<TNew> Members

        public void Insert(IEnumerable<TNew> items)
        {
            table.InsertAllOnSubmit(items);
        }

        #endregion
    }
}